<!-- 公司列表 -->
<template>
	<view class="pm20">
		<view class="pr display-flex">
			<view class=" flex-1">
				<icon type="search" size="20" class="xzczxertxrtzw"></icon>
				<input type="text"
				class="kkxcxztrtr"
				 placeholder="请输入公司名称" 
				 v-model="companyName"
				  confirm-type="search" @confirm="init" />
			</view>
			<view class=" ml20 vertical-center" v-if="companyName">
				<button type="primary" size="mini" class=" fz26 fgfdvgrt5erfe" @tap="init">搜索</button>
			</view>
		</view>
	</view>
	<view class="w100 bgff xcxtrytcrty">
			
			<view class=" display-flex pt10 pm10 btm" v-for="item in list" @tap="cxxzfdft(item)">
				<view class="xczxerxetrttwer">
					<frImage :src="item.companyImg"></frImage>
				</view>
				<view class="flex-1 ml20">
					<view class="fz32">
						{{item.companyName}}
					</view>
					<view class="fz24 z9">
						地址:{{item.companyAddr}}
					</view>
				</view>
				<view class=" vertical-center">
					<text class=" iconfont icon-rightyou fz32"></text>
				</view>
			</view>
			
			<view class="vertical-center mt100" v-if="list.length<=0">
				<image src="../../static/img/noData.png" class="xczxcertfdgtrr"></image>
				<view class="mt20 z9 fz24">
					暂无数据!
				</view>
			</view>
	</view>
</template>
<script lang="ts" setup>
	import {ref} from "vue"
	import {dxrequest} from "@/util/index.js"
	import frImage from "@/components/fr-image/fr-image.vue"
	const emit = defineEmits([
		'close',
		'success'
	]);
	const list = ref([])
	const companyName = ref()
	const init = async()=>{
		uni.showLoading({
			title:"加载中..."
		})
		const {data}  = await dxrequest("/api/tmcompany/page",{
			limit:999,
			isAuthentication:true,
			companyName:companyName.value
			
		})
		list.value = data.list
		uni.hideLoading()
	}
	init()
	
	const cxxzfdft = (data)=>{
		emit("success",data)
	}
</script>

<style scoped>

</style>